<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="../../../../../css/onsenui.css"/>
    <link rel="stylesheet" href="../../../../../css/onsen-css-components.css"/>

    <script src="../../../node_modules/onsenui/js/onsenui.js"></script>
    <script src="../../../node_modules/angular/angular.js"></script>
    <script src="../../../dist/angularjs-onsenui.js"></script>
    <script>
      ons.bootstrap()

      .controller('TestController', function($scope) {
        $scope.label = 'My label';

        $scope.currentIndex = 0;
        $scope.onPostchange = function($event) {
          $scope.currentIndex = $event.activeIndex;
        };
      });
    </script>
  </head>
  <body>
    <ons-page ng-controller="TestController">
      <ons-toolbar><div class="center">Index: <span id="current-index">{{ currentIndex }}</span></div></ons-toolbar>

      <ons-tabbar swipeable animation="none" ng-init="reactive = 0" ons-reactive="reactive = reactive + 1" ons-postchange="onPostchange($event)">
        <ons-tab id="tab1" label="{{ label }}" page="page1.html">
        </ons-tab>
        <ons-tab id="tab2" label="Page 2" page="page2.html">
        </ons-tab>
        <ons-tab id="tab3" label="Page 3" page="page3.html">
        </ons-tab>
      </ons-tabbar>
    </ons-page>

    <template id="page1.html">
      <ons-page>
        <div id="page1" style="text-align: center;">
          <p>Page 1</p>
          <p>This tab has been reactivated <span id="times-reactivated">{{ reactive }}</span> times.</p>
          <p><ons-button id="toggle-tabbar" ng-click="toggleTabs()">Toggle tabs</ons-button></p>
        </div>
      </ons-page>
    </template>

    <template id="page2.html">
      <ons-page>
        <div id="page2">
          <p style="text-align: center;">
            Page 2
            <input id="page2-input" type="text">
          </p>
        </div>
      </ons-page>
    </template>

    <template id="page3.html">
      <ons-page>
        <div id="page3">
          <p style="text-align: center;">
            Page 3
            <input id="page3-input" type="text">
          </p>
        </div>
      </ons-page>
    </template>
  </body>
</html>
